# -*- ecoding: utf-8 -*-
# @ModuleName: trade_jiesuan
# @Author: wangwei 
# @Time: 2023/10/18 21:49
from api.buyer.buyerbaseapi import BuyerBaseApi


class SetAddress(BuyerBaseApi):

    # 11777,11685,11500
    def __init__(self, address_id=11685):
        super().__init__()
        resp = CheckoutParams().send()
        defalut_address_id = resp.json().get("address_id")
        if address_id == defalut_address_id:
            address_id = 11500
        self.url = f"{self.host}/trade/checkout-params/address-id/{address_id}"
        self.method = "post"


class CheckoutParams(BuyerBaseApi):

    # 11777,11685,11500
    def __init__(self, address_id=11685):
        super().__init__()
        self.url = f"{self.host}/trade/checkout-params"
        self.method = "get"


class SetPaymentType(BuyerBaseApi):

    def __init__(self, payment_type="ONLINE"):
        super().__init__()

        self.url = f"{self.host}/trade/checkout-params/payment-type"
        self.method = "post"
        self.data = {
            "payment_type": payment_type
        }
